#include <stdio.h>
#include <string.h>

#define N_MAX 100000
#define M_MAX 100000


int
insert__after_this_series(register int index, int* where, int n)
{
	if (index < n) {
		++index;
		while (where[index] == where[index-1] && index < n)
			++index;
	}
	return index;
}


int
insert(int what, int* where, int n)
{
	int L = 0, R = n, M; /* R = n; */

	while (L < R) {
		M = (L + R) / 2;
		if (what >= where[M])
			L = M+1;
		else
			R = M;
	}
	if (where[L] > what)
		return L;
	else                                                                       /*  0 1 3 5 7 8 8 8 9 10                */
		return insert__after_this_series(L, where, n); /* never reached */ /*  _ _ _ _ _ _ _ _ ^ __ (L == 10 here) */
}


int
main(void)
{
	int n, m, origin[N_MAX], ins[M_MAX];
	int i=0;
	freopen("binary.in", "rt", stdin);
	freopen("binary.out", "w", stdout);

#ifdef DEBUG
	memset(origin, 0, sizeof(origin));
	memset(ins,    0, sizeof(ins)   );
#endif

	scanf("%d", &n);
	while (i < n)
		scanf("%d", &origin[i++]);
	i=0;
	scanf("%d", &m);
	while (i < m)
		scanf("%d", &ins[i++]);

	for (i = 0; i < m; ++i)
		printf("%d ", insert(ins[i], origin, n));
	putchar('\n');
	return 0;
}
